import { useState } from 'react';

const useFormChange = (initInfo) => {
  const [values, setValues] = useState({
    ...initInfo,
  });

  const handleChange = (val, key) => {
    values[key] = val;
    setValues({
      ...values,
    });
  };

  const updateValues = (values) => {
    setValues({
      ...values,
    });
  };

  return [values, handleChange, updateValues];
};

export default useFormChange;
